import {defineStore} from "pinia";
import {onMounted, ref} from "vue";
import {info} from "@/apis/user.js";
/*
* 存储登录时的用户信息
* */
export const useUserStore = defineStore("user",()=>{
    const user = ref({})
    const fetchUser = async (username) => {
        const response = await info(username)
        user.value = response.data
        console.log("user",user.value)
    }

    return{user,fetchUser}
}
,
    {
        persist: {
            storage: sessionStorage,
        }

    }
    )